import 'package:factoryside/bean/province_list_entity.dart';

provinceListEntityFromJson(ProvinceListEntity data, Map<String, dynamic> json) {
	if (json['StatusCode'] != null) {
		data.statusCode = json['StatusCode'] is String
				? int.tryParse(json['StatusCode'])
				: json['StatusCode'].toInt();
	}
	if (json['Info'] != null) {
		data.info = json['Info'].toString();
	}
	if (json['Count'] != null) {
		data.count = json['Count'] is String
				? int.tryParse(json['Count'])
				: json['Count'].toInt();
	}
	if (json['Data'] != null) {
		data.data = new List<ProvinceListData>();
		(json['Data'] as List).forEach((v) {
			data.data.add(new ProvinceListData().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> provinceListEntityToJson(ProvinceListEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['StatusCode'] = entity.statusCode;
	data['Info'] = entity.info;
	data['Count'] = entity.count;
	if (entity.data != null) {
		data['Data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	return data;
}

provinceListDataFromJson(ProvinceListData data, Map<String, dynamic> json) {
	if (json['Id'] != null) {
		data.id = json['Id'].toString();
	}
	if (json['code'] != null) {
		data.code = json['code'].toString();
	}
	if (json['parentcode'] != null) {
		data.parentcode = json['parentcode'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['IsUse'] != null) {
		data.isUse = json['IsUse'].toString();
	}
	if (json['Version'] != null) {
		data.version = json['Version'] is String
				? int.tryParse(json['Version'])
				: json['Version'].toInt();
	}
	return data;
}

Map<String, dynamic> provinceListDataToJson(ProvinceListData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['Id'] = entity.id;
	data['code'] = entity.code;
	data['parentcode'] = entity.parentcode;
	data['name'] = entity.name;
	data['IsUse'] = entity.isUse;
	data['Version'] = entity.version;
	return data;
}